<!-- Modal -->
<div class="modal fade " id="markPaymentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">标记已还款</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal">
                <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">还款金额</label>
                        <div class="col-sm-7">
                            <input id="markPaymentModal_amount" type="text" class="form-control"
                                   style="width: 100%;"
                                   disabled="disabled">
                            <input id="markPaymentModal_billInfoId" type="hidden">
                        </div>
                    </div>

                    <div class="form-group" id="weightDiv">
                        <label for="inputEmail3" class="col-sm-2 control-label">还款方式</label>
                        <div class="col-sm-7">
                            <select id="markPaymentModal_payType" style="width: 150px"  class="form-control select2"  onchange="refreshTable('table1')">
                                <option value="1" selected>支付宝</option>
                                <option value="2">微信</option>
                                <option value="3">银行app</option>
                            </select>
                        </div>
                    </div>  
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button id="btnSubmit" type="button" class="btn btn-primary pull-right"
                            onclick="markPaymentModal_save()">标记
                    </button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>

<script>

    function markPaymentModal_init() {

        $("#markPaymentModal_issuerId").val("");
        $("#markPaymentModal_name").val("");
        $("#markPaymentModal_dataSource").val("");
        $("#markPaymentModal_issuerMark").val("");



        $("#windCodeDiv").css("display","block");
        $("#changeEnterTypeBtn").css("display","block");
        $("#markPaymentModal_windCode").val("");
        $("#markPaymentModal_msg").html("");
        $("#markPaymentModal_windCode").removeAttr("disabled");
        $("#markPaymentModal_custId").val("");
        $("#markPaymentModal_custName").val("");
        $("input[name='markPaymentModal_isCityInvest'][value='0']").attr("checked", 'true');
        $("#markPaymentModal_externalEnvironment").val("");
        $("#markPaymentModal_businessOperation").val("");
        $("#markPaymentModal_financialPerformance").val("");
    }

    function markPaymentModal_setValue(index) {
        $("#windCodeDiv").css("display","none");
        $("#changeEnterTypeBtn").css("display","none");
        $("#markPaymentModal_custName").attr("disabled","disabled") ;
        var options = $("#table1").bootstrapTable("getData");
        var row = options[index];
        var url = "/scorebasicdata/cust/info?issuerId=" + row.id;
        getReq(url,function (result) {
            if(result.length != 0) {
                var data = result[0] ;
                $("#markPaymentModal_custId").val(data.id);
                $("#markPaymentModal_custName").val(data.custName);
                $("input[name='markPaymentModal_isCityInvest'][value='" + data.isCityInvest + "']").attr("checked", 'true');
                $("#markPaymentModal_externalEnvironment").val(data.externalEnvironment);
                $("#markPaymentModal_businessOperation").val(data.businessOperation);
                $("#markPaymentModal_financialPerformance").val(data.financialPerformance);
            }
        });

    }


    function markPaymentModal_save() {
        var data = {
            id: $("#markPaymentModal_custId").val(),
            custName: $("#markPaymentModal_custName").val(),
            windCode: $("#markPaymentModal_windCode").val(),
            isCityInvest: $("input[name=markPaymentModal_isCityInvest]:checked").val(),
            externalEnvironment: $("#markPaymentModal_externalEnvironment").val(),
            businessOperation: $("#markPaymentModal_businessOperation").val(),
            financialPerformance: $("#markPaymentModal_financialPerformance").val()
        };
        var url = "/scorebasicdata/cust/save";
        postReq(url, data, function (result) {
            if (result.success) {
                toastr['success']('操作成功', '提示');
                $("#table1").bootstrapTable("refresh");
                $("#markPaymentModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        });
    }
</script>
